package com.ruoyi.sgsc.service.impl;

import java.util.List;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ruoyi.sgsc.mapper.productsMapper;
import com.ruoyi.sgsc.domain.products;
import com.ruoyi.sgsc.service.IproductsService;

/**
 * 商品Service业务层处理
 * 
 * @author wy
 * @date 2024-09-29
 */
@Service
public class productsServiceImpl implements IproductsService 
{
    @Autowired
    private productsMapper productsMapper;

    /**
     * 根据商品id查询商品
     * 
     * @param productId 商品主键
     * @return 商品
     */
    @Override
    public products selectproductsByProductId(Long productId)
    {
        return productsMapper.selectproductsByProductId(productId);
    }

    /**
     * 根据多条商品id获取多条商品
     * @param productIds
     * @return
     */
    @Override
    public List<products> selectproductsByProductIds(Long[] productIds)
    {
        return productsMapper.selectproductsByProductIds(productIds);
    }



    /**
     * 根据商品id查询商品
     *
     * @param categoryId 商品主键
     * @return 商品
     */
    @Override
    public List<products>  selectproductsByCategoryId(Long categoryId)
    {
        return productsMapper.selectproductsByCategoryId(categoryId);
    }

    /**
     * 查询商品收藏情况
     * @param isActive
     * @return
     */
    public List<products>  selectproductsByIsActive(Integer isActive)
    {
        return productsMapper.selectproductsByIsActive(isActive);
    }


    /**
     * 查询商品列表
     * 
     * @param products 商品
     * @return 商品
     */
    @Override
    public List<products> selectproductsList(products products)
    {
        return productsMapper.selectproductsList(products);
    }

    /**
     * 新增商品
     * 
     * @param products 商品
     * @return 结果
     */
    @Override
    public int insertproducts(products products)
    {
        return productsMapper.insertproducts(products);
    }

    /**
     * 修改商品
     * 
     * @param products 商品
     * @return 结果
     */
    @Override
    public int updateproducts(products products)
    {
        return productsMapper.updateproducts(products);
    }

    /**
     * 批量删除商品
     * 
     * @param productIds 需要删除的商品主键
     * @return 结果
     */
    @Override
    public int deleteproductsByProductIds(Long[] productIds)
    {
        return productsMapper.deleteproductsByProductIds(productIds);
    }

    /**
     * 删除商品信息
     * 
     * @param productId 商品主键
     * @return 结果
     */
    @Override
    public int deleteproductsByProductId(Long productId)
    {
        return productsMapper.deleteproductsByProductId(productId);
    }



}
